branch-3.1: [fix](paimon) Align incremental query behavior with Spark Paimon for single snapshot scenario #58239#58253
Merged
morrySnow merged 1 commit intobranch-3.1from Nov 25, 2025
Conversation
…single snapshot scenario (#58239) ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: When a Paimon table has only 1 snapshot, users cannot perform incremental queries. The validation logic in Doris has two issues: 1. It rejects queries where `startSnapshotId = endSnapshotId`: ```sql SELECT * FROM tb_simple@incr('startSnapshotId'='1', 'endSnapshotId'='1'); -- Error: startSnapshotId must be less than endSnapshotId ``` 2. It rejects queries where `startSnapshotId = 0` (which is needed to query all data from a single snapshot): ```sql SELECT * FROM tb_simple@incr('startSnapshotId'='0', 'endSnapshotId'='1'); -- Error: startSnapshotId must be greater than 0 ``` This behavior is inconsistent with Spark Paimon, which: - Allows `startSnapshotId = endSnapshotId` (returns empty result) - Allows `startSnapshotId = 0` to query all data from the initial state to the specified snapshot ## Solution Align Doris incremental query behavior with Spark Paimon: 1. **Allow `startSnapshotId = 0`**: This enables querying all data from a single snapshot by using `startSnapshotId=0, endSnapshotId=1` 2. **Allow `startSnapshotId = endSnapshotId`**: This matches Spark Paimon behavior (returns empty result when querying the same snapshot) 3. **Update validation**: Allow `startSnapshotId >= 0` and `endSnapshotId >= 0` (previously `> 0`)
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
morrySnow
approved these changes
Nov 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #58239